Optimal. Leaf size=59 \[ \frac {x (a A+b B)}{a^2+b^2}-\frac {(A b-a B) \log (a \sin (c+d x)+b \cos (c+d x))}{d \left (a^2+b^2\right )} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.08, antiderivative size = 59, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.087, Rules used = {3531, 3530} \[ \frac {x (a A+b B)}{a^2+b^2}-\frac {(A b-a B) \log (a \sin (c+d x)+b \cos (c+d x))}{d \left (a^2+b^2\right )} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3530
Rule 3531
Rubi steps
\begin {align*} \int \frac {A+B \cot (c+d x)}{a+b \cot (c+d x)} \, dx &=\frac {(a A+b B) x}{a^2+b^2}-\frac {(A b-a B) \int \frac {-b+a \cot (c+d x)}{a+b \cot (c+d x)} \, dx}{a^2+b^2}\\ &=\frac {(a A+b B) x}{a^2+b^2}-\frac {(A b-a B) \log (b \cos (c+d x)+a \sin (c+d x))}{\left (a^2+b^2\right ) d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.13, size = 67, normalized size = 1.14 \[ -\frac {2 (a A+b B) \tan ^{-1}(\cot (c+d x))+(A b-a B) \left (2 \log (a+b \cot (c+d x))-\log \left (\csc ^2(c+d x)\right )\right )}{2 d \left (a^2+b^2\right )} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.55, size = 79, normalized size = 1.34 \[ \frac {2 \, {\left (A a + B b\right )} d x + {\left (B a - A b\right )} \log \left (a b \sin \left (2 \, d x + 2 \, c\right ) + \frac {1}{2} \, a^{2} + \frac {1}{2} \, b^{2} - \frac {1}{2} \, {\left (a^{2} - b^{2}\right )} \cos \left (2 \, d x + 2 \, c\right )\right )}{2 \, {\left (a^{2} + b^{2}\right )} d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.53, size = 95, normalized size = 1.61 \[ \frac {\frac {2 \, {\left (A a + B b\right )} {\left (d x + c\right )}}{a^{2} + b^{2}} - \frac {{\left (B a - A b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} + \frac {2 \, {\left (B a^{2} - A a b\right )} \log \left ({\left | a \tan \left (d x + c\right ) + b \right |}\right )}{a^{3} + a b^{2}}}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.42, size = 187, normalized size = 3.17 \[ -\frac {\ln \left (a +b \cot \left (d x +c \right )\right ) A b}{d \left (a^{2}+b^{2}\right )}+\frac {\ln \left (a +b \cot \left (d x +c \right )\right ) a B}{d \left (a^{2}+b^{2}\right )}+\frac {\ln \left (\cot ^{2}\left (d x +c \right )+1\right ) A b}{2 d \left (a^{2}+b^{2}\right )}-\frac {\ln \left (\cot ^{2}\left (d x +c \right )+1\right ) a B}{2 d \left (a^{2}+b^{2}\right )}-\frac {A \pi a}{2 d \left (a^{2}+b^{2}\right )}-\frac {B \pi b}{2 d \left (a^{2}+b^{2}\right )}+\frac {A \,\mathrm {arccot}\left (\cot \left (d x +c \right )\right ) a}{d \left (a^{2}+b^{2}\right )}+\frac {B \,\mathrm {arccot}\left (\cot \left (d x +c \right )\right ) b}{d \left (a^{2}+b^{2}\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 1.69, size = 89, normalized size = 1.51 \[ \frac {\frac {2 \, {\left (A a + B b\right )} {\left (d x + c\right )}}{a^{2} + b^{2}} + \frac {2 \, {\left (B a - A b\right )} \log \left (a \tan \left (d x + c\right ) + b\right )}{a^{2} + b^{2}} - \frac {{\left (B a - A b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}}}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 1.00, size = 155, normalized size = 2.63 \[ \frac {A\,\ln \left (\mathrm {cot}\left (c+d\,x\right )+1{}\mathrm {i}\right )}{2\,\left (b\,d+a\,d\,1{}\mathrm {i}\right )}-\frac {B\,\ln \left (\mathrm {cot}\left (c+d\,x\right )+1{}\mathrm {i}\right )}{2\,\left (a\,d-b\,d\,1{}\mathrm {i}\right )}-\frac {A\,b\,\ln \left (a+b\,\mathrm {cot}\left (c+d\,x\right )\right )}{d\,\left (a^2+b^2\right )}+\frac {B\,a\,\ln \left (a+b\,\mathrm {cot}\left (c+d\,x\right )\right )}{d\,\left (a^2+b^2\right )}+\frac {A\,\ln \left (\mathrm {cot}\left (c+d\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{2\,\left (a\,d+b\,d\,1{}\mathrm {i}\right )}-\frac {B\,\ln \left (\mathrm {cot}\left (c+d\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{2\,\left (-b\,d+a\,d\,1{}\mathrm {i}\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 1.11, size = 534, normalized size = 9.05 \[ \begin {cases} \frac {\tilde {\infty } x \left (A + B \cot {\relax (c )}\right )}{\cot {\relax (c )}} & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {\frac {A \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + B x}{b} & \text {for}\: a = 0 \\- \frac {i A d x \cot {\left (c + d x \right )}}{- 2 b d \cot {\left (c + d x \right )} + 2 i b d} - \frac {A d x}{- 2 b d \cot {\left (c + d x \right )} + 2 i b d} + \frac {i A}{- 2 b d \cot {\left (c + d x \right )} + 2 i b d} - \frac {B d x \cot {\left (c + d x \right )}}{- 2 b d \cot {\left (c + d x \right )} + 2 i b d} + \frac {i B d x}{- 2 b d \cot {\left (c + d x \right )} + 2 i b d} - \frac {B}{- 2 b d \cot {\left (c + d x \right )} + 2 i b d} & \text {for}\: a = - i b \\\frac {i A d x \cot {\left (c + d x \right )}}{- 2 b d \cot {\left (c + d x \right )} - 2 i b d} - \frac {A d x}{- 2 b d \cot {\left (c + d x \right )} - 2 i b d} - \frac {i A}{- 2 b d \cot {\left (c + d x \right )} - 2 i b d} - \frac {B d x \cot {\left (c + d x \right )}}{- 2 b d \cot {\left (c + d x \right )} - 2 i b d} - \frac {i B d x}{- 2 b d \cot {\left (c + d x \right )} - 2 i b d} - \frac {B}{- 2 b d \cot {\left (c + d x \right )} - 2 i b d} & \text {for}\: a = i b \\\frac {x \left (A + B \cot {\relax (c )}\right )}{a + b \cot {\relax (c )}} & \text {for}\: d = 0 \\\frac {2 A a d x}{2 a^{2} d + 2 b^{2} d} - \frac {2 A b \log {\left (\tan {\left (c + d x \right )} + \frac {b}{a} \right )}}{2 a^{2} d + 2 b^{2} d} + \frac {A b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{2} d + 2 b^{2} d} + \frac {2 B a \log {\left (\tan {\left (c + d x \right )} + \frac {b}{a} \right )}}{2 a^{2} d + 2 b^{2} d} - \frac {B a \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{2} d + 2 b^{2} d} + \frac {2 B b d x}{2 a^{2} d + 2 b^{2} d} & \text {otherwise} \end {cases} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________